package com.lalilu.remote.entity

import com.lalilu.remote.utils.GsonUtils
import java.net.InetAddress

class Host(
    val port: Int,
    val address: InetAddress,
    val deviceName: String
) {
    override fun toString(): String {
        return GsonUtils.toJson(this)
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as Host

        if (port != other.port) return false
        if (address != other.address) return false

        return true
    }

    override fun hashCode(): Int {
        var result = port
        result = 31 * result + address.hashCode()
        return result
    }
}